﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Configuration_Fabrics_Default" %>



<asp:Content ID="Content4" ContentPlaceHolderID="title" Runat="Server">
    Configuraci&oacute;n - Telas
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderBreadcrumbs" Runat="Server">
    <ul>
        <li>Configuraci&oacute;n</li>
        <li>Telas</li>
    </ul>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceMain" Runat="Server">

    <h2 class="pagetitle">Telas</h2>
    <div class="block">
        <asp:TextBox ID="txtSearchTerm" runat="server" class="fields-filter" style="margin-right:0px;" Text=""></asp:TextBox>
        <asp:ImageButton class="button-filter" runat="server" ID="btnSearch" AlternateText="Buscar" ToolTip="Buscar" OnClick="btnSearch_Click" 
            CausesValidation="false" ImageUrl="~/img/search-icon.png"/>
    </div>
    <div class="column1-unit">
        
        <asp:gridview ID="grid" runat="server" OnPageIndexChanging="grid_PageIndexChanging" OnSorting="grid_Sorting" DataSourceID="ds" 
            AutoGenerateColumns="False" EmptyDataText="No Existen Registros" AllowPaging="True" PageSize="10" DataKeyNames="Id" 
            OnRowCommand="grid_RowCommand"  BorderWidth="1" CellPadding="5" CellSpacing="0" ShowFooter="true" AlternatingRowStyle-CssClass="row-alternation" OnRowDataBound="grid_RowDataBound" >
                <Columns>  
                    <asp:TemplateField HeaderText="Nombre" HeaderStyle-CssClass="top" SortExpression="Name">
                        <ItemTemplate>    
                            <asp:Label ID="lblName" runat="server" Text='<%# Bind("Name") %>'></asp:Label>     
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtName" runat="server" CssClass="table-input-field" 
                                Text='<%# Bind("Name") %>' MaxLength="255"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="FNvalidator" runat="server" Display="Dynamic" ForeColor="Red" SetFocusOnError="true"
                                ControlToValidate="txtName" ValidationGroup="Updategrid" ErrorMessage="Requerido"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtName" runat="server" CssClass="table-input-field" 
                                Text=''  MaxLength="255"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="FNvalidator" runat="server" Display="Dynamic" ForeColor="Red" SetFocusOnError="true"
                                ControlToValidate="txtName" ValidationGroup="AddGrid" ErrorMessage="Requerido"></asp:RequiredFieldValidator>
                        </FooterTemplate>
                    </asp:TemplateField> 
                    <asp:TemplateField HeaderText="Descripci&oacute;n" HeaderStyle-CssClass="top">
                        <ItemTemplate>    
                            <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("Description") %>'></asp:Label>     
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" CssClass="table-input-field" 
                                Text='<%# Bind("Description") %>' Width="100%"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" CssClass="table-input-field" 
                                Width="100%"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField> 
                    <asp:TemplateField HeaderStyle-CssClass="top" HeaderStyle-Width="60px" ItemStyle-CssClass="status" FooterStyle-CssClass="status">
                        <HeaderTemplate>
                            Acciones
                        </HeaderTemplate>
                        <EditItemTemplate> 
                            <asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="true" ValidationGroup="Updategrid" CommandName="UpdateRow" 
                                ToolTip="Guardar Tela" height="16px" ImageUrl="~/img/save-icon.png"></asp:ImageButton> 
                            <asp:ImageButton ID="ImageButton4" runat="server" CausesValidation="false" CommandName="Cancel" 
                                ToolTip="Cancelar" height="16px" ImageUrl="~/img/Cancel-icon.png"></asp:ImageButton> 
                        </EditItemTemplate> 
                        <FooterTemplate > 
                            <asp:ImageButton ID="LinkButton2" runat="server" CausesValidation="true" ValidationGroup="AddGrid" CommandName="AddNew" 
                                ToolTip="Guardar Tela" height="16px" ImageUrl="~/img/save-icon.png"></asp:ImageButton> 
                        </FooterTemplate> 
                        <ItemTemplate> 
                            <asp:ImageButton ToolTip="Editar Tela" ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit" 
                                ImageUrl="~/img/edit-icon.png" height="16px"></asp:ImageButton>
                            <asp:ImageButton ToolTip="Eliminar Tela" ID="imgDelete" runat="server" CausesValidation="False" CommandName="DeleteRow" 
                                OnClientClick='<%# GetConfirmValue(Eval("Id").ToString()) %>' 
                                ImageUrl="~/img/delete-icon.png" height="16px"></asp:ImageButton> 
                        </ItemTemplate> 
                    </asp:TemplateField>
                </Columns>
            </asp:gridview>
            <asp:ObjectDataSource ID="ds" runat="server" TypeName="BLLLaundry" SelectMethod="GetFabrics"
                EnablePaging="true" SelectCountMethod="GetFabricsCount" StartRowIndexParameterName="startRow"
                MaximumRowsParameterName="pageSize" SortParameterName="sortColumns" UpdateMethod="Update" DeleteMethod="Delete">        
                <SelectParameters>
                    <asp:SessionParameter  DefaultValue="" Name="sortExp" SessionField="sortExp" Type="String" />
                    <asp:SessionParameter DefaultValue="" Name="sortDirection" SessionField="sortDirection" Type="String" />
                    <asp:SessionParameter  DefaultValue="" Name="pageIndex" SessionField="pageIndex" Type="Int32" />
                    <asp:SessionParameter  DefaultValue="" Name="filterSearch" SessionField="filterSearch" Type="String" />
                </SelectParameters>              
            </asp:ObjectDataSource>
        </div>
        <asp:HiddenField runat="server" ID="hdnId" />
    <asp:Button runat="server" ID="lnkDelete" OnClick="lnkDelete_Click" style="display:none;"></asp:Button>
        <div id="dialog" style="display:none;"></div>
    <script type="text/javascript">
       
        function confirmMessage(title, message, id) {
            $("#dialog").html(message);
            $("#<%=hdnId.ClientID %>").val(id);
            $("#dialog").dialog(
                {
                    modal: true,
                    title: title,
                    buttons:
                    {
                        "Ok": function () {
                            $(this).dialog("close");
                            $("#<%=lnkDelete.ClientID %>").click();
                        },
                        "Cancelar": function () {
                            $(this).dialog("close");
                        }
                    }
                });
                return false;
            }
    </script>
</asp:Content>

